import React, { Component, PropTypes } from 'react';
import DataTable from '../../DataTable'

class DervicesType extends Component {
  constructor () {
    super()
    this.state = {
      tableConfig: {
        columns: [{
          title: '类型名称',
          name: 'name'
        }, {
          title: '描述',
          name: 'des'
        }, {
          title: '排序',
          name: 'seq'
        }, {
          command: [{
            name: 'create'
          }, {
            name: 'edit',
            text: '编辑'
          }, {
            name: 'delete',
            text: '删除'
          }]
        }],
        transport: {
          read: {
            url: '/api/dervicesType/getPagination',
            parse: () => {}
          },
          create: '/api/dervicesType/add',
          update: {
            url: '/api/dervicesType/edit',
            format: () => {}
          },
          destroy: '/api/dervicesType/del'
        }
      }
    }
  }

  static contextTypes = {
    onSetTitle: PropTypes.func.isRequired
  }

  render() {
    this.context.onSetTitle('设备类型')

    return (
      <div>
        <DataTable config={this.state.tableConfig} />
      </div>
    )
  }
}

export default DervicesType